<template>
  <div class="count">
    <h2>Count组件:{{ count }}</h2>
    <p>总价格是:{{ totalPrice }}</p>
    <p>电影列表的长度是{{ movieList.length }}</p>
    <button @click="increment">累加count</button>
    <button @click="incrementN({ n: 3 })">累加N count</button>
    <button @click="incrementWait">等两秒再累加</button>
    <button @click="incrementNWait({ n: 3 })">等两秒再累加N</button>
  </div>
</template>

<script>
import { mapState, mapGetters, mapMutations, mapActions } from "vuex";
export default {
  name: "Count",
  mounted() {
    console.log(this);
  },
  computed: {
    ...mapState("count", ["count", "num"]),
    ...mapState("movie", ["movieList"]),
    ...mapGetters("count", ["totalPrice"]),
  },
  methods: {
    ...mapMutations("count", ["increment", "incrementN"]),
    ...mapActions("count", ["incrementWait", "incrementNWait"]),
  },
};
</script>

<style scoped>
.count {
  background-color: pink;
}
</style>
